#!/usr/bin/env python 
# -*- coding:utf-8 -*-
"""
@Time:2022/3/5 下午2:52"
@Author:lydia_liu"
@File:base_page.py
@function:
"""
from selenium import webdriver
from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.common.by import By


class BasePage:


    _base_url = 'http://litemall.hogwarts.ceshiren.com/#/login'
    def __init__(self, driver:WebDriver = None):
        if driver is None:
            self.driver = webdriver.Chrome()
            self.driver.implicitly_wait(5)
            self.driver.maximize_window()

            self.driver.get(self._base_url)
        else:
            self.driver = driver


    def on_click(self,by:By,locator:str):

        self.driver.find_element(by,locator).click()

    def sendkeys(self,by,locator,value):

        element = self.driver.find_element(by,locator)
        element.clear()
        element.send_keys(value)



